package com.hnkywl.sts.action.cwgl.kmys;

import com.hnkywl.sts.entity.organ.Khh;
import com.hnkywl.sts.service.organ.KhhService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 13-5-16
 * Time: 下午4:55
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/cwgl/kmys/yhzhkmdmys")
public class YhzhkmdmysAction extends SimpleActionSupport{
    private KhhService khhService;
    //内部公司ID
    private Long nbgsId;
    //开户行
    private Khh khh;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows;

    @Action("yhzhkmdmysList")
    public void findKmdmList(){
        renderJson(khhService.findKmdmList(nbgsId,page,rows));
    }

    @Action("save_yhzhkmdmys")
    public void save(){
        try{
            khhService.saveKmdm(khh);
            renderJson("{\"statusCode\":200}");
        }catch (Exception  e) {
            e.printStackTrace();
            renderJson("{\"statusCode\":300,\"message\":\""+e.getMessage()+"\"}");
        }
    }

    public Long getNbgsId() {
        return nbgsId;
    }

    public void setNbgsId(Long nbgsId) {
        this.nbgsId = nbgsId;
    }

    public Khh getKhh() {
        return khh;
    }

    public void setKhh(Khh khh) {
        this.khh = khh;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    @Autowired
    public void setKhhService(KhhService khhService) {
        this.khhService = khhService;
    }
}
